package net.cityside.summer.serivce.impl;

import net.cityside.summer.domain.User;
import net.cityside.summer.mapper.UserMapper;
import net.cityside.summer.serivce.IUserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

public class UserService implements IUserService {

	@Autowired
	private UserMapper userMapper;

	@Override
	public User getById(long id) {
		return userMapper.getById(id);
	}

	@Override
	public User getByUserName(String username) {
		return userMapper.getByUserName(username);
	}

	@Override
	public User getUserWithAuthoritiesByUsername(String username) {
		User user = userMapper.getWithAuthoritiesByUserName(username);
		return user;
	}

	@Transactional
	@Override
	public User save(User user) {
		userMapper.save(user);
		return user;
	}

}
